<template>
  <div>
    <svg-icon icon-class="message" @click="click" />
  </div>
</template>

<script>
export default {
  name: 'Doc',
  data() {
    return {
      qq_jia: false
    }
  },
  methods: {
    click() {
      var sUserAgent = navigator.userAgent.toLowerCase()
      var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad'
      var bIsIphoneOs = sUserAgent.match(/iphone os/i) == 'iphone os'
      var bIsMidp = sUserAgent.match(/midp/i) == 'midp'
      var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4'
      var bIsUc = sUserAgent.match(/ucweb/i) == 'ucweb'
      var bIsAndroid = sUserAgent.match(/android/i) == 'android'
      var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce'
      var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile'
      if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
        popwin = window.location.href = 'tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=2512915749'
      } else {
        window.location.href = 'https://qm.qq.com/cgi-bin/qm/qr?k=yT8sRSrzGzyqQDOKXl_8qaELT0dTbjwE&noverify=0'
      }
      setTimeout(this.CloseWebPage(), 3000)
    }
  },
  CloseWebPage() {
    if (navigator.userAgent.indexOf('MSIE') > 0) {
      if (navigator.userAgent.indexOf('MSIE 6.0') > 0) {
        window.opener = null
        window.close()
      } else {
        window.open('', '_top')
        window.top.close()
      }
    } else if (navigator.userAgent.indexOf('Firefox') > 0) {
      window.location.href = 'about:blank '
    } else {
      window.opener = null
      window.open('', '_self', '')
    }
  }
}
</script>
